package entity;

import java.util.Date;

public class Order {
    private int orderId;
    private int buyerId;
    private int itemId;
    private Date orderDate;
    private double totalAmount;
    private String status;

    // 构造方法
    public Order() {}

    public Order(int buyerId, int itemId, double totalAmount) {
        this.buyerId = buyerId;
        this.itemId = itemId;
        this.totalAmount = totalAmount;
        this.orderDate = new Date();
        this.status = "待付款";
    }

    // Getter和Setter方法
    public int getOrderId() { return orderId; }
    public void setOrderId(int orderId) { this.orderId = orderId; }

    public int getBuyerId() { return buyerId; }
    public void setBuyerId(int buyerId) { this.buyerId = buyerId; }

    public int getItemId() { return itemId; }
    public void setItemId(int itemId) { this.itemId = itemId; }

    public Date getOrderDate() { return orderDate; }
    public void setOrderDate(Date orderDate) { this.orderDate = orderDate; }

    public double getTotalAmount() { return totalAmount; }
    public void setTotalAmount(double totalAmount) { this.totalAmount = totalAmount; }

    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }

    @Override
    public String toString() {
        return "订单ID: " + orderId + ", 商品ID: " + itemId + ", 总金额: ¥" + totalAmount +
                ", 状态: " + status + ", 下单时间: " + orderDate;
    }
}